using System;

class MinMaxToN
{
	static void Main()
	{
		Console.Write("N=");
		int min = int.MinValue;
		int max = int.MaxValue;
		int n = Int32.Parse(Console.ReadLine());
		Console.Write("\n");
		Console.WriteLine("Input {0} numbers", n);
		int number=int.MinValue;
		for (int num = 1; num <= n; num++)
		{
			number = Int32.Parse(Console.ReadLine());
			if (max>=number)
			{
				max = number;
			}
			else if (min <= number)
			{
				min = number;
			}
		}
		Console.WriteLine("Min: {0} Max: {1}",min, max);
	
	  double close=a[0]-a[1];
	  double distant=a[0]-a[2];
	  int point1distant=0;
	  int point2distant=2;
	  int point1close=0;
	  int point2close=1;
	  for(i=0;i<N;i++)
	  {
	   for(int j=1;j<N-1;j++)
	   {
		if (distant>=(a[i]-a[j]))
		{
		 distant = a[i]-a[j];
		 point1distant = a[i];
		 point2distant = a[j];
		 
		}
		else if (close <= (a[i]-a[j]))
		{
		 close = a[i]-a[j];
		 point1close = a[i];
		 point2close = a[j];
		}
	   }
	  }
	  cout<<"Nai-blizki tochki edna ot druga: "<<point1close<<" i "<<point2close<<" s razlika "<<close<<endl;
	  cout<<"Nai-otdalecheni tochki edna ot druga: "<<point1distant<<" i "<<point2distant<<" s razlika "<<distant<<endl;
	}
}